package com.woniu.product.controller;

import com.woniu.common.util.ResponseData;
import com.woniu.product.pojo.TSkuComment;
import com.woniu.product.service.TSkuCommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author 杜梅杰
 * @Description
 * @Date 2024/5/27 19:27
 */
@RestController
public class CommentController {
    @Autowired
    private TSkuCommentService tSkuCommentService;

    @PostMapping("/addComment")
    public ResponseData<?> addComment(@RequestBody TSkuComment comment) {
        return tSkuCommentService.addComment(comment);
    }

    @GetMapping("/queryComment/{orderId}")
    public ResponseData<?> queryComment(@PathVariable("orderId") String orderId) {
        return tSkuCommentService.queryComment(orderId);
    }

    @PostMapping("/updateComment")
    public ResponseData<?> updateComment(@RequestBody TSkuComment comment) {
        return tSkuCommentService.updateComment(comment);
    }

    @GetMapping("/queryCommentByUserId/{userId}")
    public ResponseData<?> queryCommentByUserId(@PathVariable("userId") Long userId) {
        return tSkuCommentService.queryCommentByUserId(userId);
    }

    @GetMapping("/deleteShopComment/{returnId}")
    private ResponseData<?> deleteShopComment(@PathVariable("returnId") Long returnId) {
        return tSkuCommentService.deleteShopComment(returnId);
    }

    @PostMapping("/deleteMyComment")
    private ResponseData<?> deleteMyComment(@RequestBody TSkuComment comment) {
        return tSkuCommentService.deleteMyComment(comment);
    }
}
